set(PACKAGE_VERSION @VERSION_SERIES@.@VERSION_MAJOR@.@VERSION_MINOR@)

# Match the version just as precisely as it was specified

if(PACKAGE_FIND_VERSION_MAJOR STREQUAL "@VERSION_SERIES@")
  set(_MAJOR_MATCHES TRUE)
else()
  set(_MAJOR_MATCHES FALSE)
endif()
if(PACKAGE_FIND_VERSION_MINOR STREQUAL "@VERSION_MAJOR@")
  set(_MINOR_MATCHES TRUE)
else()
  set(_MINOR_MATCHES FALSE)
endif()
if(PACKAGE_FIND_VERSION_PATCH STREQUAL "@VERSION_MINOR@")
  set(_PATCH_MATCHES TRUE)
else()
  set(_PATCH_MATCHES FALSE)
endif()

if(PACKAGE_FIND_VERSION_COUNT EQUAL 0)
  set(PACKAGE_VERSION_COMPATIBLE TRUE)
elseif(PACKAGE_FIND_VERSION_COUNT EQUAL 1 AND _MAJOR_MATCHES)
  set(PACKAGE_VERSION_COMPATIBLE TRUE)
elseif(PACKAGE_FIND_VERSION_COUNT EQUAL 2 AND
       _MAJOR_MATCHES AND _MINOR_MATCHES)
  set(PACKAGE_VERSION_COMPATIBLE TRUE)
elseif(PACKAGE_FIND_VERSION_COUNT GREATER 2 AND
       _MAJOR_MATCHES AND _MINOR_MATCHES AND _PATCH_MATCHES)
  set(PACKAGE_VERSION_COMPATIBLE TRUE)
else()
  set(PACKAGE_VERSION_COMPATIBLE FALSE)
endif()

if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
  set(PACKAGE_VERSION_EXACT TRUE)
endif()

# bitness checks copied from autogenerated CMakePackageConfigHelpers version file

# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
  return()
endif()

# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@")
  math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8")
  set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
  set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()
